import store from "./store";
import { connect } from "react-redux";
import {
  getInputChangeAction,
  getBtnClickAction,
  getDeleteItemAction,
  InitStateAction,
  getInitList,
  getTodoList,
} from "./action";
const mapStateToProps = (state) => {
  return {
    inputValue: state.inputValue,
    list: state.list,
  };
};
const mapDispatchToprops = (dispatchEvent) => {
  return {
    getTodoList() {
      // getTodoList 返回的是一个 异步函数 的action
      dispatchEvent(getTodoList());
    },
    getBtnClickAction() {
      // getBtnClickAction 是一个函数 返回了定义的action
      console.log("getBtnClickAction是啥？？", getBtnClickAction);
      dispatchEvent(getBtnClickAction());
    },
    getInputChangeAction(e) {
      dispatchEvent(getInputChangeAction(e));
    },
    getDeleteItemAction(index) {
      dispatchEvent(getDeleteItemAction(index));
    },
  };
};

export default connect(mapStateToProps, mapDispatchToprops);
